package xzy.com.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import xzy.com.dao.ArticleMapper;
import xzy.com.dao.MenuMapper;
import xzy.com.entity.domain.Article;
import xzy.com.entity.domain.Menu;
import xzy.com.service.ArticleService;

@Service
public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> implements ArticleService {

	@Autowired
	private MenuMapper menuMapper;
	// 根据类别查询菜单

	@Override
	public IPage<Article> findArticleType(Page<Article> page, QueryWrapper<Article> queryWrapper) {
		return this.baseMapper.findArticleType(page, queryWrapper);
	}

	@Override
	public List<Menu> findMenuByType() {
		QueryWrapper<Menu> queryWrapper = new QueryWrapper<Menu>();
		queryWrapper.eq("parent_id", 0);
		return menuMapper.selectList(queryWrapper);
	}

}
